const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,
  devServer: {
    client: {
      overlay: false
    },
    // 端口号
    port: 8080,
    // 启用 https
    https: false,
    // 自动打开浏览器
    open: true,
    // 代理配置
    proxy: {
      '/api': {
        target: process.env.VUE_APP_API_URL, // 目标服务器地址
        changeOrigin: true,
        pathRewrite: {
          '^/api': '' // 重写路径
        },
        before: function (app) {
          app.use((req, res, next) => {
            console.log(`Request URL: ${req.url}`)
            next()
          })
        }
      }
    }
  }
})
